package org.longsheng.GroovyLearn.java.aop;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DynamicProxyUtil {

    public static <T> T getProxy(Class<T> clazz, T obj) {
        InvocationHandler wordProxyHandler = new WordProxyHandler(obj);

        return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[]{clazz}, wordProxyHandler);
    }
}
